package model.components.nodes.node;

public class PhysicalServer extends PhysicalNode
{
	public static final String NAME_PREFIX = "PhysicalServer";
	
	@Override
	public int getDiskSpace(){ return diskSpace; }
	@Override
	public void setDiskSpace( int diskSpace ){ this.diskSpace = diskSpace; }
	
	@Override
	public int getAvailableDiskSpace(){ return availableDiskSpace; }	
	@Override
	public void setAvailableDiskSpace( int availableDiskSpace ){ this.availableDiskSpace = availableDiskSpace; }
	
	public PhysicalServer( String nameNetwork, int number, String operatingSystem, String virtualEnvironment, int cpu, int memory, int diskSpace, int maxVirtualNodesNumber )
	{	
		super( nameNetwork, PhysicalServer.NAME_PREFIX, number, Node.SERVER_TYPE, operatingSystem, virtualEnvironment, cpu, memory, maxVirtualNodesNumber, "/icons/greyPhysicalServer.png", "/icons/greenPhysicalServer.png", "/icons/yellowPhysicalServer.png", "/icons/redPhysicalServer.png" );
		
		this.setDiskSpace( diskSpace );
		this.setAvailableDiskSpace( diskSpace );
	}
	
	@Override
	public PhysicalServer getCopy()
	{
		PhysicalServer physicalServer = new PhysicalServer( this.getNetworkName(), this.getNumber(), this.getOperatingSystem(), this.getVirtualEnvironment(), this.getCpu(), this.getMemory(), this.getDiskSpace(), this.getAvailableVirtualNodesNumber() );
		physicalServer.setInitialNumber( this.getInitialNumber() );
		physicalServer.setNamePrefix( this.getNamePrefix() );
		physicalServer.setType( this.getType() );
		physicalServer.setAvailableCpu( this.getAvailableCpu() );
		physicalServer.setAvailableMemory( this.getAvailableMemory() );
		physicalServer.setAvailableDiskSpace( this.getAvailableDiskSpace() );		
		physicalServer.setMaxVirtualNodesNumber( this.getMaxVirtualNodesNumber() );
		physicalServer.setTimeStamp( this.getTimeStamp() );
		physicalServer.setSelected( this.isSelected() );
		
		for( VirtualNode virtualNode: this.getVirtualNodes() )
			physicalServer.add( virtualNode.getCopy() );
		
		return physicalServer;
	}
	
}
